import turtle
import random
points = []
for i in range(3):
    y = random.randint(-340, 340)
    points.append([340, y])
n = 0
pos_star = [0, 340]
def star(pos):
    turtle.up()
    turtle.goto(pos)
    turtle.down()
    turtle.dot(30, 'cyan')
def game():
    turtle.clear()
    global n
    if n == 10:
        for i in range(3):
            y = random.randint(-340, 340)
            points.append([340, y])
        n=0
    star(pos_star)
    clear_points = []
    is_stop = False
    for point in points:
        turtle.penup()
        turtle.goto(point)
        turtle.pendown()
        turtle.dot(20, 'gold')
        if pos_star[1]<-350 or pos_star[1]>350 or \
                abs(point[0]-pos_star[0]) <22 and \
                abs(point[1]-pos_star[1])<22:
            is_stop = True
        point[0] -= 10
        if point[0] <-340:
            clear_points.append(point)
    for i in clear_points:
        points.remove(i)
    pos_star[1] -= 10
    n += 1
    if not is_stop:
        turtle.ontimer(game, 150)
def click(x, y):
    pos_star[1] +=30
turtle.tracer(False)
game()
turtle.onscreenclick(click)
turtle.done()